<template>
	<view class="video-container">
		<!-- :poster="{{poster}}" -->
		<video id="myVideo" :src="videoUrl" :controls="controls" :autoplay="false" :loop="false" object-fit="fill" binderror="videoErrorCallback"
			:show-mute-btn="true" :enable-auto-rotation="true" style="width: 100%;height: 100%;"></video>
	</view>
</template>

<script>
	export default {
		props: {
			videoUrl: {
				type: String,
				default: () =>
					`https://open.ys7.com/v3/openlive/J22653029_1_1.m3u8?expire=1676615524&id=546337979833004032&t=3a98e54bf568b56f96ac9f6ca61336391c7130279920000310e48c6bfc24d89d&ev=100`
			},
		},
		data() {
			return {
				controls: true
			}
		},
		onReady() {
		    this.videoContext = wx.createVideoContext('myVideo')
		},
		// methods: {
			videoErrorCallback(e) {
			    console.log('视频错误信息:')
			    console.log(e.detail.errMsg)
			  }
		// }
	}
</script>

<style>
	.video-container {
		width: 100%;
		height: 100%;
	}
</style>